 /**
 * 上海中赢金融信息服务有限公司
 * Copyright (c) 2017-2027 Chinazyjr,Inc.All Rights Reserved.
 */
package com.sys.midware.httpClient.crawler;

import com.gargoylesoftware.htmlunit.BrowserVersion;

/**
 * 
 * <b>Description：</b> 一个枚举，表示在抓取过程中使用的浏览器版本 <br/>
 * <b>ClassName：</b> CrawlBrowserVersion <br/>
 * <b>@author：</b> jackyshang <br/>
 * <b>@date：</b> 2016年7月1日 上午10:27:17 <br/>
 * <b>@version: </b>  <br/>
 */
public enum CrawlBrowserVersion {
	FIREFOX_24("ff24", BrowserVersion.FIREFOX_24), CHROME("chrome",
			BrowserVersion.CHROME), IE11("ie11",
			BrowserVersion.INTERNET_EXPLORER_11);

	public static CrawlBrowserVersion getCrawlBrowser(final String stringValue) {
		final CrawlBrowserVersion[] bs = CrawlBrowserVersion.values();
		for (final CrawlBrowserVersion b : bs) {
			if (b.stringValue.equalsIgnoreCase(stringValue)) {
				return b;
			}
		}
		return getDefault();
	}

	public static CrawlBrowserVersion getDefault() {
		return CrawlBrowserVersion.CHROME;
	}

	private final String stringValue;
	private final BrowserVersion browserVersion;

	private CrawlBrowserVersion(final String stringValue,
			final BrowserVersion browserVersion) {
		this.stringValue = stringValue;
		this.browserVersion = browserVersion;
	}

	public String getStringValue() {
		return stringValue;
	}

	public BrowserVersion getBrowserVersion() {
		return browserVersion;
	}

}
